﻿namespace IDAL
{
    public interface IBaseDAL<T>
    {
        /// <summary>
        /// 新增一个对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> AddAsync(T entity);
        /// <summary>
        /// 批量新增对象
        /// </summary>
        /// <param name="entites"></param>
        /// <returns></returns>
        Task<int> AddRangeAsync(List<T> entites);
        /// <summary>
        /// 更新一个对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T entity);
        /// <summary>
        /// 批量更新对象
        /// </summary>
        /// <param name="entites"></param>
        /// <returns></returns>
        Task<int> UpdateRangeAsync(List<T> entites);
        /// <summary>
        /// 删除一个对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> DeleteAsync(T entity);
        /// <summary>
        /// 批量删除对象
        /// </summary>
        /// <param name="entites"></param>
        /// <returns></returns>
        Task<int> DeleteRangeAsync(List<T> entites);

        /// <summary>
        /// 通用预备查询
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetValues();
    }
}
